/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package cn.edu.dyxy.yinyy.modules.blockly.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import cn.edu.dyxy.yinyy.modules.blockly.entity.BlocklyProject;
import cn.edu.dyxy.yinyy.modules.blockly.dao.BlocklyProjectDao;
import com.jeesite.modules.file.utils.FileUploadUtils;

/**
 * Blockly设计项目Service
 * @author 尹元元
 * @version 2020-03-21
 */
@Service
@Transactional(readOnly=true)
public class BlocklyProjectService extends CrudService<BlocklyProjectDao, BlocklyProject> {
	
	/**
	 * 获取单条数据
	 * @param blocklyProject
	 * @return
	 */
	@Override
	public BlocklyProject get(BlocklyProject blocklyProject) {
		return super.get(blocklyProject);
	}
	
	/**
	 * 查询分页数据
	 * @param blocklyProject 查询条件
	 * @param blocklyProject.page 分页对象
	 * @return
	 */
	@Override
	public Page<BlocklyProject> findPage(BlocklyProject blocklyProject) {
		return super.findPage(blocklyProject);
	}
	
	/**
	 * 保存数据（插入或更新）
	 * @param blocklyProject
	 */
	@Override
	@Transactional(readOnly=false)
	public void save(BlocklyProject blocklyProject) {
		super.save(blocklyProject);
		// 保存上传图片
		FileUploadUtils.saveFileUpload(blocklyProject.getId(), "blocklyProject_image");
		// 保存上传附件
		FileUploadUtils.saveFileUpload(blocklyProject.getId(), "blocklyProject_file");
	}
	
	/**
	 * 更新状态
	 * @param blocklyProject
	 */
	@Override
	@Transactional(readOnly=false)
	public void updateStatus(BlocklyProject blocklyProject) {
		super.updateStatus(blocklyProject);
	}
	
	/**
	 * 删除数据
	 * @param blocklyProject
	 */
	@Override
	@Transactional(readOnly=false)
	public void delete(BlocklyProject blocklyProject) {
		super.delete(blocklyProject);
	}
}